//
// Copyright (c) 2024 BPergaofeng
//
#ifndef BPerAPP_BPerPushEncoder_H_
#define BPerAPP_BPerPushEncoder_H_

#include <bperutil/buffer/BPerAudioBuffer.h>
#include <bperutil/buffer/BPerAudioEncoderBuffer.h>
#include <bperutil/buffer/BPerVideoEncoderBuffer.h>
#include <bperutil/buffer/BPerVideoBuffer.h>

#include <bperencoder/BPerAudioEncoderHandle.h>
#include <bperencoder/BPerVideoEncoderHandle.h>


class BPerPushEncoder {
public:
    BPerPushEncoder(BPerContext *pcontext);

    virtual ~BPerPushEncoder();

public:
    void setVideoInfo(BPerVideoInfo *pvideo);

    void initVideoEncoder();

    void initAudioEncoder();

    void startAudioEncoder();

    void startVideoEncoder();

    void setInAudioBuffer(BPerAudioBuffer *pal);

    void setInVideoBuffer(BPerVideoBuffer *pvl);

    BPerAudioEncoderBuffer *getOutAudioBuffer();

    BPerVideoEncoderBuffer *getOutVideoBuffer();

    BPerVideoMeta *getOutVideoMetaData();

    void stopAll();

    void sendMsgToEncoder(BPerRequestType req);

    void deleteVideoEncoder();

private:

    BPerVideoEncoderHandle *m_ve;
    BPerAudioEncoderHandle *m_ae;

    BPerAudioEncoderBuffer *m_out_auidoBuffer;
    BPerVideoEncoderBuffer *m_out_videoBuffer;

    BPerContext *m_context;
    BPerVideoMeta *m_vmd;
    BPerVideoInfo *m_videoInfo;
};

#endif /* BPerAPP_BPerENCODERAPP_H_ */
